package com.kznnc.data_structure.algorithm;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * @Description  贪心算法
 *   问题: 安排最多场次的会议
 * @Author houchenkai
 * @Created Date: 2021/7/12 17:07
 * @ClassName
 */
public class GreedyAlgorithm {


    static  class  Meeting implements Comparable<Meeting>{
        int meNum; //会议编号
        int startTime;
        int endTime;

        @Override
        public int compareTo(Meeting o) {
            if (this.endTime > o.endTime){
                return 1;
            }
            return -1;
        }

        public Meeting(int meNum, int startTime, int endTime) {
            super();
            this.meNum = meNum;
            this.startTime = startTime;
            this.endTime = endTime;
        }
    }

    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        List<Meeting> meetings = new ArrayList<>();
        int n = cin.nextInt();
        for (int i = 0; i < n; i++) {
            int start = cin.nextInt();
            int end = cin.nextInt();
            Meeting meeting = new Meeting(i+1,start,end);
            meetings.add(meeting);
        }
        meetings.sort(null);

    }

}
